FROM  java:8 as builder

ARG JAR_FILE=./*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract

FROM  registry.cn-hangzhou.aliyuncs.com/kefu-space/jdk:1.8.0_202

WORKDIR /kefu/apps

COPY --from=builder dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder application/ ./

ENV JVM_XMS=512m
ENV JVM_XMX=512M
ENV JAVA_OPTS="-Xms$JVM_XMS -Xmx$JVM_XMX"
CMD java -Dfile.encoding=utf-8 -Xms${JVM_XMS} -Xmx${JVM_XMX}  org.springframework.boot.loader.JarLauncher
